package com.ycg.vue.modules.system.controller;

import com.ycg.vue.modules.system.Dto.MaterialLibraryDto;
import com.ycg.vue.modules.system.Entity.MaterialLibraryEntity;
import com.ycg.vue.modules.system.service.MaterialLibraryService;
import com.ycg.vue.result.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description
 * @Author jink
 * @Date 2024/6/19
 */
@RestController
@RequestMapping("/materialLibrary/")
public class MaterialLibraryController {
    @Resource
    private MaterialLibraryService materialLibraryService;

    @PostMapping("addNew")
    public Result addNew(@RequestBody MaterialLibraryEntity entity) {
        return materialLibraryService.addNew(entity);
    }

    @PostMapping("list")
    public Result list(@RequestBody MaterialLibraryDto dto) {
        return materialLibraryService.list(dto);
    }

    @PostMapping("changeMaterialStatus")
    public Result changeMaterialStatus(@RequestBody MaterialLibraryDto dto) {
        return materialLibraryService.changeMaterialStatus(dto);
    }

    @DeleteMapping("deleteMaterial/{id}")
    public Result deleteMaterial(@PathVariable("id") String id) {
        return materialLibraryService.deleteMaterial(id);
    }
}
